#include <iostream>
using namespace std;
#include <fstream>
#include <vector>
#include <algorithm>

bool cmp(int x,int y)
{
    return x>y;
}

int main(int argc,char*argv[])
{
    //读取
    ifstream in;
    in.open("sort.txt");
    if(!in.is_open())
    {
        cerr<<"error\n";
        return -1;
    }
    //存入vector
    int x;
    vector<int> nums;
    while(in>>x)
    {
        nums.push_back(x);
    }
    //关闭
    in.close();

    //排序
    sort(nums.begin(),nums.end(),cmp);

    //写入
    ofstream out;
    out.open("sort.txt");
    if(!out.is_open())
    {
        cerr<<"error\n";
        return -1;
    }

    for(vector<int>::iterator it = nums.begin();it != nums.end();it++)
    {
        out<<*it;
        out<<" ";
    }
    out<<endl;
    
    //关闭
    out.close();

    return 0;
}